﻿using log4net;
using System;
using System.IO;
using System.Threading.Tasks;

namespace Quartz.Server
{

    [DisallowConcurrentExecution]
    public class EricAnotherSimpleJob : IJob
    {
        private static readonly ILog logger = LogManager.GetLogger(typeof(EricAnotherSimpleJob));
        public Task Execute(IJobExecutionContext context)
        {
            logger.Info("发送邮件....");

            string filepath = @"D:\timertest.txt";

            if (!File.Exists(filepath))
            {
                using (FileStream fs = File.Create(filepath)) { }
            }

            using (StreamWriter sw = new StreamWriter(filepath, true))
            {
                sw.WriteLine(DateTime.Now.ToLongTimeString());
            }
            return Task.CompletedTask;
        }

    }
}
